﻿@{
    Layout = null;
}
@* 码申请 *@

<script src="~/Scripts/MGJJS/CodeManage/ApplyCode.js"></script>
<link href="~/Scripts/Bootstrap/css/bootstrap-datepicker3.min.css" rel="stylesheet" />
<script src="~/Scripts/Bootstrap/js/bootstrap-datepicker.js"></script>
<div class="mtlr15">
    <form id="SearchForm" role="form" onkeydown="if(event.keyCode==13){return false;}">
        <div class="row">
            <div class="col-lg-7 col-md-7 col-sm-7" style="padding:0">
                <button type="button" class="btn btn-success" onclick="$.MGJ.ApplyCode.Dialog_ApplyCode()">
                    <i class="glyphicon glyphicon-plus-sign"></i>
                    新增申请
                </button>
            </div>

            <div class="col-lg-5 col-md-5 col-sm-5">
                <div class="input-group">
                    <div style="width:100%;display:none"></div>
                    <input id="SerialNum" name="SerialNum" type="text" class="form-control" placeholder="流水号" onkeydown="if (event.keyCode == 13) { $.MGJ.ApplyCode.Ajax_GetApplyList(1); }">
                    <span class="input-group-addon" onclick="$.MGJ.ApplyCode.Ajax_GetApplyList(1);">
                        <span class="glyphicon glyphicon-search"></span>
                    </span>
                    <div class="input-group-btn" style="margin-left:1px;" onclick="detailSearch(this)">
                        <button type="button" class="btn btn-default" style="border: 1px solid transparent;">
                            更多搜索
                            <span class="caret"></span>
                        </button>
                    </div>
                </div>
            </div>
        </div>

        <div class="detail-search-con" style="display:none">
            <div class="row newrow">
                <div class="col-lg-1 col-md-1 col-sm-1 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 text-right" style="padding:0">
                    开始时间
                </div>
                <div class="col-lg-2 col-md-2 col-sm-2">
                    <input id="StartDate" type="text" name="StartDate" class="form-control" placeholder="开始时间" />
                </div>
                <div class="col-lg-1 col-md-1 col-sm-1 col-sm-2 text-right" style="padding:0">
                    结束时间
                </div>

                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-3">
                    <input id="EndDate" type="text" name="EndDate" class="form-control" placeholder="结束时间" />
                </div>


            </div>
            <div class="row newrow">
                <div class="col-lg-1 col-md-1 col-sm-1 col-lg-offset-1 col-md-offset-1 col-sm-offset-1 text-right" style="padding:0">
                    申请数量
                </div>
                <div class="col-lg-2 col-md-2 col-sm-2">
                    <input type="text" name="ApplyCount" class="form-control" placeholder="流水号" />
                </div>
                <div class="col-lg-1 col-md-1 col-sm-1 col-sm-2 text-right" style="padding:0">
                    应用产品
                </div>

                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-2">
                    <input type="text" name="ApplyProduct" class="form-control" placeholder="应用产品" />
                </div>

                <div class="col-lg-2 col-md-2 col-sm-2 col-sm-2 text-center">
                    <button type="button" class="btn btn-default" style="margin-left:23px;" onclick="$.MGJ.ApplyCode.Ajax_GetApplyList(1)">
                        <span class="glyphicon glyphicon-search"></span>
                        搜索
                    </button>
                    <button type="reset" class="btn btn-default">
                        重置
                    </button>
                </div>
            </div>
        </div>
    </form>

    <div id="Table">
        <div class="overflow">
            <table class="table table-hover table-bordered">
                <thead>
                    <tr>
                        <th class="empty">流水号</th>
                        <th>申请码类型</th>
                        <th>应用产品</th>
                        <th>产品规格</th>
                        <th>申请数量</th>
                        <th>状态</th>
                        <th>申请人</th>
                        <th>申请时间</th>
                        <th class="empty">操作</th>
                    </tr>
                </thead>
                <tbody id="ApplyList" style="display:none;" binding="{'pageId':'ApplycodePager','pageCallback':'$.MGJ.ApplyCode.Ajax_GetApplyList','emptyHtml':OMID_EmptyHtml}">
                    <tr>
                        <td binding="{'text':'SerialNum'}"> </td>
                        <td class="ApplyCodeType" binding="{'text':'CodeFunc','textHandle':$.MGJ.ApplyCode.Ajax_handers}"></td>
                        <td class="AllotProductName" binding="{'text':'AllotProductName'}"></td>
                        <td binding="{'text':'ApplyProductSize'}"></td>
                        <td binding="{'text':'ApplyCount'}"></td>
                        <td binding="{'text':'HasVerifie','textHandle':$.MGJ.ApplyCode.ReturnVerifieState}"></td>
                        <td binding="{'text':'ApplyUserName'}"></td>
                        <td binding="{'text':'ApplyDate','textHandle':'datetime'}"></td>
                        <td binding="{'text':'HasVerifie','textHandle':$.MGJ.ApplyCode.ReturnOpButton}">
                            @*<a>取消</a>
                            <a>查看</a>*@
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div id="ApplycodePager"></div>
    </div>
</div>

<script>
    $("#StartDate").datepicker({
        format: "yyyy-mm-dd",
        language: 'cn',
        todayBtn: "linked",
        autoclose: true,
        todayHighlight: true,
        endDate: new Date()
    }).on('changeDate', function (e) {
        var startTime = e.date;
        $('#EndDate').datepicker('setStartDate', startTime);
    });
    $("#EndDate").datepicker({
        format: "yyyy-mm-dd",
        language: 'cn',
        todayBtn: "linked",
        autoclose: true,
        todayHighlight: true,
        endDate: new Date()
    }).on('changeDate', function (e) {
        var endTime = e.date;
        $('#StartDate').datepicker('setEndDate', endTime);
    });
    var ColspanNub = $(".table.table-hover.table-bordered").find("tr").children("td").length
    window.OMID_EmptyHtml = '<tr><td colspan="' + ColspanNub + '"><p class="no-result">无符合条件的数据结果</p></td></tr>';

    $(function () {
        $.MGJ.ApplyCode.Ajax_GetApplyList(1);
    });

    $('#SearchForm').bootstrapValidator({
        fields: {
            //SerialNum: {
            //    validators: {
            //        regexp: {
            //            regexp: /^[a-zA-Z\u4e00-\u9fa5]+$/,
            //            message: '流水号只能输入字母和数字'
            //        }
            //    }
            //},
            ApplyProduct: {
                validators: {
                    regexp: {
                        regexp: /^[a-zA-Z0-9\u4e00-\u9fa5]+$/,
                        message: '应有产品不能输入符号'
                    }
                }
            }
        }
    })
</script>